﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Google.Maps.Geocoding;
using Google.Maps.Direction;

namespace BartonExtension
{
    public static class GeocodingExtension
    {
        public static GeocodeResponse requestGeometryDataFromAddr(this string addr)
        {
            try
            {
                var request = new GeocodingRequest();
                request.Address = addr;
                //request.Language = "zh-HK";
                //request.Region = "hk";
                request.Sensor = false;
                GeocodingService service = new GeocodingService();
                var response = service.GetResponse(request);
                return response;
            }
            catch (Exception ex)
            {
                return null;
            }
        }
    }
}
